package com.wxy.demo.client;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

import javax.xml.namespace.QName;

/**
 * @author wangxiaoyuan
 * 2021/3/19 15:32
 **/
public class CxfDynamicClient {
    public static void main(String[] args) throws Exception {
        //采用动态工厂方式 不需要指定服务接口
        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
        Client client = dcf
                .createClient("http://localhost:8089/myservice?wsdl");
        QName qName = new QName("http://com.soft.ws/my", "authorization");
        Object[] result = client.invoke(qName,
                "admin", "123456");
        System.out.println(result[0]);
    }
}
